package com.liuyandog.server;

import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.awt.*;

public class UserBorrowServer extends UserUI {
    /*借阅书籍界面*/
    static         JLabel[] jLables=new JLabel[5];
    static          JTextField[] jTextField=new JTextField[5];
    JButton search;
    public UserBorrowServer(){
        setLayout(null);
        JPanel interactivePanel=new JPanel();
        interactivePanel.setSize(500,100);
        interactivePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
        interactivePanel.setLocation(50,300);
        interactivePanel.setBorder(new TitledBorder("书籍信息"));
        add(interactivePanel);

        search = new JButton("查询");
        search.setFont(new Font("宋体", Font.BOLD, 20));
        search.setBounds(100,300,150,30);
        int i=0;

        jLables[0]=new JLabel("书籍编号:");
        jLables[1]=new JLabel("书籍名称:");
        jLables[2]=new JLabel("出版社:");
        jLables[3]=new JLabel("书籍类别:");
        jLables[4]=new JLabel("作者:");
        while(i<jTextField.length){
            jTextField[i]=new JTextField(10);
            interactivePanel.add(jLables[i]);
            interactivePanel.add(jTextField[i]);
            i++;
        }
        Object[] columnNames = {"书籍编号", "书籍名称", "书籍简介", "作者", "价格","书籍类别","出版社"};

        // 表格所有行数据
        interactivePanel.setLocation(100,400);

        JScrollPane jScrollPane=new JScrollPane();
        JPanel tablePanel=new JPanel();
        tablePanel.setLocation(150,200);
        tablePanel.setSize(600,300);

        Object[][] rowData = {
                {"1", 80, 80, 80, 240,1,1,1},
        };
        JTable jTable = new JTable(rowData,columnNames);
        jTable.setAutoResizeMode(50);
        tablePanel.add(jTable.getTableHeader());
        tablePanel.add(jTable);
        jScrollPane.add(tablePanel);
        add(jScrollPane);
        add(search);
        search.addActionListener(this);
    }
}
